package com.jadesoft.common.web;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class RequestContext {
	private HttpServletRequest request;
	private HttpServletResponse response;
	private ServletContext servletContext;
	private boolean multipart;
	private boolean success = true;
	private String message;
	private static ThreadLocal<RequestContext> instance = new ThreadLocal<RequestContext>();
	
	RequestContext(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, boolean isMultipart) {
		this.request = request;
		this.response = response;
		this.servletContext = servletContext;
		this.multipart = isMultipart;
	}
	
	public static RequestContext get() {
		return instance.get();
	}
	
	public static void set(RequestContext requestContext) {
		instance.set(requestContext);
	}

	public HttpServletRequest getRequest() {
		return request;
	}
	public HttpServletResponse getResponse() {
		return response;
	}
	public ServletContext getServletContext() {
		return servletContext;
	}
	public boolean isSuccess() {
		return success;
	}
	public void setSuccess(boolean success) {
		this.success = success;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public boolean isMultipart() {
		return multipart;
	}
	
}
